package com.jalarbee.stock.category.business;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.jalarbee.core.money.MonetaryAmount;
import javax.persistence.Column;
import org.hibernate.annotations.Columns;
import org.hibernate.annotations.Type;

@Entity
public class Discount implements Serializable {

    private static final long serialVersionUID = 1L;
    public static final int PERCENT = 1;
    public static final int AMOUNT = 2;
    public static final int ALL = 3;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;
    @Temporal(TemporalType.DATE)
    private Date startDate;
    @Temporal(TemporalType.DATE)
    private Date endDate;
    private int type;
    @Type(type = "com.jalarbee.core.money.MonetaryAmountType")
    @Columns(columns = {
        @Column(name = "CURRENCY"),
        @Column(name = "AMOUNT")})
    private MonetaryAmount amount;
    private double percentage;

    public Discount() {
    }

    public Discount(int type) {
        this.type = type;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public MonetaryAmount getAmount() {
        return amount;
    }

    public void setAmount(MonetaryAmount amount) {
        this.amount = amount;
    }

    public double getPercentage() {
        return percentage;
    }

    public void setPercentage(double percentage) {
        this.percentage = percentage;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
}
